package qq2564874169.tuaotuao.fx.orm;

import qq2564874169.tuaotuao.fx.EventDispatcher;
import qq2564874169.tuaotuao.fx.orm.query.SqlQuery;

public interface Sql extends SqlQuery {
    EventDispatcher<SqlBeforeArgs> evBefore();

    EventDispatcher<SqlAfterArgs> evAfter();

    EventDispatcher<SqlErrorArgs> evError();

    int execute(SqlParam param);

    default int execute(String sql, Object param, boolean isProc, Integer timeout) {
        SqlParam sqlParam = SqlParam.createFor(sql, param, isProc, timeout);
        return execute(sqlParam);
    }

    default int execute(String sql, Object param, boolean isProc) {
        return execute(sql, param, isProc, null);
    }

    default int execute(String sql, Object param) {
        return execute(sql, param, false);
    }

    default int execute(String sql) {
        return execute(sql, null);
    }
}
